Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Language Guide / Part 2 - AppleScript Language Reference
Chapter 6 - Expressions


Variables

A variable is a named container in which to store a value. When AppleScript encounters a variable in a statement, it evaluates the variable by getting its value. Variables are contained in a script, not in an application, and their values are normally lost when you close the script that contains them. If you need to keep track of variable values that are persistent even after you close a script or shut down your computer, use properties instead of variables. See "Script Properties," which begins on page 156, for more information.

Unlike variables in many other programming languages, AppleScript variables can hold values of any class. For example, you can use the following sequence of assignment statements to set x to a string value, an integer value, and finally a Boolean value:

set x to "Title"set x to 12
set x to True
The name of a variable is a series of characters, called an identifier, that you specify when you create the variable.


Subtopics
Creating Variables
Using Variables
The "A Reference To" Operator
Data Sharing
Scope of Variables
Predefined Variables

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996